/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    background-image: url('/static/images/background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    box-sizing: border-box;
    min-height: 100vh;
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 30px;
}

.container {
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 85%;
    max-width: 1000px;
    box-sizing: border-box;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.chat-container {
    margin-bottom: 0;
    /*height: 500px;*/
}

.log-container {
    height: 200px;
    overflow: auto;
}

/* 对话框样式 */
.consultation-dialog {
    height: 50vh;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* 防止水平滚动 */
}

.dialog-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.message {
    display: flex;
    margin-bottom: 20px;
    gap: 16px;
    padding: 8px 16px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* 各角色消息样式 */
.receptionist-message {
    background-color: #f0f7ff;
}

.doctor-message {
    background-color: #f0fff4;
}

.pharmacist-message {
    background-color: #fff5f5;
}

.patient-message {
    background-color: #f8f9fa;
}

.system-message {
    background-color: #f5f5f5;
    font-style: italic;
}

/* 头像样式 */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.receptionist-message .message-avatar {
    background-color: #4299e1;
}

.doctor-message .message-avatar {
    background-color: #48bb78;
}

.pharmacist-message .message-avatar {
    background-color: #ed8936;
}

.patient-message .message-avatar {
    background-color: #718096;
}

.system-message .message-avatar {
    background-color: #a0aec0;
}

.message-content {
    flex-grow: 1;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: calc(100% - 60px); /* 确保内容不会超出消息区域 */
}

/* 输入区域样式 */
.dialog-input {
    border-top: 1px solid #e5e5e5;
    padding: 20px;
    background-color: #fff;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.dialog-input textarea {
    width: 100%;
    min-height: 52px;
    max-height: 200px;
    padding: 12px 45px 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.dialog-input textarea:focus {
    outline: none;
    border-color: #4299e1;
}

.dialog-input button {
    position: absolute;
    right: 32px;
    bottom: 32px;
    background-color: transparent;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: #4299e1;
    transition: color 0.2s;
}

.dialog-input button:hover {
    color: #2b6cb0;
}

.dialog-input button:disabled {
    color: #cbd5e0;
    cursor: not-allowed;
}

/* 诊断结果样式 */
.diagnosis-result {
    margin-top: 30px;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    background-color: #fff;
    width: 100%;
    box-sizing: border-box;
}

.diagnosis-result h4 {
    color: #2d3748;
    margin-bottom: 16px;
}

.diagnosis-result h5 {
    color: #4a5568;
    margin: 12px 0 8px;
}

.prescription-details {
    padding: 16px;
    background-color: #f7fafc;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
}

.medications ul {
    list-style: none;
    padding-left: 0;
}

.medications li {
    padding: 8px 0;
    border-bottom: 1px solid #edf2f7;
}

.medications li:last-child {
    border-bottom: none;
}

.instructions, .notes {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #edf2f7;
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 1040px) {
    .container {
        padding: 15px;
        margin: 0 10px;
    }
    
    body {
        padding: 10px;
    }
    
    .message {
        padding: 8px 10px;
    }
}

@media (max-width: 600px) {
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .message-content {
        max-width: calc(100% - 40px);
    }
    
    .dialog-input {
        padding: 15px;
    }
    
    .dialog-input button {
        right: 25px;
        bottom: 27px;
    }
}

/* Interaction Log Styling */
#interactionLog {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    font-size: 0.9em;
    margin-top: 15px;
}

.interaction-log-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.interaction-log-list li {
    border-bottom: 1px solid #eee;
    padding: 5px 0;
    display: flex;
    align-items: flex-start;
}

.interaction-log-list li:last-child {
    border-bottom: none;
}

.log-timestamp {
    flex: 0 0 80px;
    color: #666;
    font-family: monospace;
    font-size: 0.9em;
    padding-right: 10px;
}

.log-content {
    flex: 1;
}

.log-details {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
    margin-left: 5px;
}

/* Agent-specific colors */
.role-receptionist {
    color: #4a86e8;
}

.role-doctor {
    color: #6aa84f;
}

.role-pharmacist {
    color: #a64d79;
}

.role-system {
    color: #999999;
}

.role-user {
    color: #e69138;
}
